Skip to content

Conversation

cetagostini
Copy link
Contributor

@cetagostini cetagostini commented Sep 16, 2025

Description

Introduces the ModelSamplerEstimator utility to estimate computational time of a PyMC models using JAX/NumPyro, including logp/gradient evaluation time and NUTS step counts. The output should be the minimum sample time from their models. Doing so, users could compare the minimum amount of time that their given model will take.

Adds corresponding tests to validate estimator output and schema for simple and multidimensional models.

Example:

est = ModelSamplerEstimator(
    tune=1000, draws=1000, chains=4, sequential_chains=1, seed=1
)
df = est.run(model)

Important

Only working with JAX at the moment.

Related Issue

  • Closes #
  • Related to #

Checklist


📚 Documentation preview 📚: https://pymc-marketing--1943.org.readthedocs.build/en/1943/

Introduces the ModelSamplerEstimator utility to estimate computational characteristics of PyMC models using JAX/NumPyro, including logp/gradient evaluation time and NUTS step counts. Adds corresponding tests to validate estimator output and schema for simple and multidimensional models.
@github-actions github-actions bot added the tests label Sep 16, 2025
@cetagostini cetagostini self-assigned this Sep 16, 2025
@cetagostini cetagostini added enhancement New feature or request MMM model components Related to the various model components labels Sep 16, 2025
@cetagostini
Copy link
Contributor Author

I have a few PRs, I'll add examples in the notebook on another PR :)

Copy link

codecov bot commented Sep 16, 2025

Codecov Report

❌ Patch coverage is 98.52941% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.18%. Comparing base (34ba743) to head (099d987).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pymc_marketing/pytensor_utils.py 98.52% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1943      +/-   ##
==========================================
+ Coverage   92.12%   92.18%   +0.05%     
==========================================
  Files          67       67              
  Lines        8079     8147      +68     
==========================================
+ Hits         7443     7510      +67     
- Misses        636      637       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cetagostini
Copy link
Contributor Author

@juanitorduz or @williambdean ready for review!

Copy link
Collaborator

@juanitorduz juanitorduz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor comments

@juanitorduz juanitorduz added this to the 0.17.0 milestone Sep 21, 2025
@cetagostini
Copy link
Contributor Author

@juanitorduz feedback apply!

@juanitorduz juanitorduz merged commit fa1403c into main Sep 23, 2025
33 checks passed
@juanitorduz juanitorduz deleted the cetagostini/model_jax_sampler_estimator branch September 23, 2025 14:01
@juanitorduz
Copy link
Collaborator

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request MMM model components Related to the various model components tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants